﻿using System.Windows;
using System.Windows.Media;

namespace WPFTemplateLib.Attached
{
    /// <summary>
    /// WPF Xaml 元素属性代理（用于设置属性以便在控件模板等地方使用）
    /// </summary>
    public class WpfXamlPropProxy : DependencyObject
    {
        #region 圆角
        public static CornerRadius GetCornerRadius(DependencyObject obj)
        {
            return (CornerRadius)obj.GetValue(CornerRadiusProperty);
        }

        public static void SetCornerRadius(DependencyObject obj, CornerRadius value)
        {
            obj.SetValue(CornerRadiusProperty, value);
        }

        /// <summary>
        /// 圆角
        /// </summary>
        public static readonly DependencyProperty CornerRadiusProperty =
            DependencyProperty.RegisterAttached("CornerRadius", typeof(CornerRadius), typeof(WpfXamlPropProxy), new PropertyMetadata(new CornerRadius()));
        #endregion

        #region 边框粗细
        public static Thickness GetBorderThickness(DependencyObject obj)
        {
            return (Thickness)obj.GetValue(BorderThicknessProperty);
        }

        public static void SetBorderThickness(DependencyObject obj, Thickness value)
        {
            obj.SetValue(BorderThicknessProperty, value);
        }

        /// <summary>
        /// 边框粗细
        /// </summary>
        public static readonly DependencyProperty BorderThicknessProperty =
            DependencyProperty.RegisterAttached("BorderThickness", typeof(Thickness), typeof(WpfXamlPropProxy), new PropertyMetadata(new Thickness()));
        #endregion

        #region 边框画刷
        public static Brush GetBorderBrush(DependencyObject obj)
        {
            return (Brush)obj.GetValue(BorderBrushProperty);
        }

        public static void SetBorderBrush(DependencyObject obj, Brush value)
        {
            obj.SetValue(BorderBrushProperty, value);
        }

        /// <summary>
        /// 边框画刷
        /// </summary>
        public static readonly DependencyProperty BorderBrushProperty =
            DependencyProperty.RegisterAttached("BorderBrush", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 鼠标移上的背景画刷
        public static Brush GetMouseOverBackground(DependencyObject obj)
        {
            return (Brush)obj.GetValue(MouseOverBackgroundProperty);
        }

        public static void SetMouseOverBackground(DependencyObject obj, Brush value)
        {
            obj.SetValue(MouseOverBackgroundProperty, value);
        }

        /// <summary>
        /// 鼠标移上的背景画刷
        /// </summary>
        public static readonly DependencyProperty MouseOverBackgroundProperty =
            DependencyProperty.RegisterAttached("MouseOverBackground", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 鼠标移上的前景画刷
        public static Brush GetMouseOverForeground(DependencyObject obj)
        {
            return (Brush)obj.GetValue(MouseOverForegroundProperty);
        }

        public static void SetMouseOverForeground(DependencyObject obj, Brush value)
        {
            obj.SetValue(MouseOverForegroundProperty, value);
        }

        /// <summary>
        /// 鼠标移上的前景画刷
        /// </summary>
        public static readonly DependencyProperty MouseOverForegroundProperty =
            DependencyProperty.RegisterAttached("MouseOverForeground", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 鼠标移上的边框画刷
        public static Brush GetMouseOverBorderBrush(DependencyObject obj)
        {
            return (Brush)obj.GetValue(MouseOverBorderBrushProperty);
        }

        public static void SetMouseOverBorderBrush(DependencyObject obj, Brush value)
        {
            obj.SetValue(MouseOverBorderBrushProperty, value);
        }

        /// <summary>
        /// 鼠标移上的边框画刷
        /// </summary>
        public static readonly DependencyProperty MouseOverBorderBrushProperty =
            DependencyProperty.RegisterAttached("MouseOverBorderBrush", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 鼠标按下的背景画刷
        public static Brush GetPressedBackground(DependencyObject obj)
        {
            return (Brush)obj.GetValue(PressedBackgroundProperty);
        }

        public static void SetPressedBackground(DependencyObject obj, Brush value)
        {
            obj.SetValue(PressedBackgroundProperty, value);
        }

        /// <summary>
        /// 鼠标按下的背景画刷
        /// </summary>
        public static readonly DependencyProperty PressedBackgroundProperty =
            DependencyProperty.RegisterAttached("PressedBackground", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 鼠标按下的前景画刷
        public static Brush GetPressedForeground(DependencyObject obj)
        {
            return (Brush)obj.GetValue(PressedForegroundProperty);
        }

        public static void SetPressedForeground(DependencyObject obj, Brush value)
        {
            obj.SetValue(PressedForegroundProperty, value);
        }

        /// <summary>
        /// 鼠标按下的前景画刷
        /// </summary>
        public static readonly DependencyProperty PressedForegroundProperty =
            DependencyProperty.RegisterAttached("PressedForeground", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 鼠标按下的边框画刷
        public static Brush GetPressedBorderBrush(DependencyObject obj)
        {
            return (Brush)obj.GetValue(PressedBorderBrushProperty);
        }

        public static void SetPressedBorderBrush(DependencyObject obj, Brush value)
        {
            obj.SetValue(PressedBorderBrushProperty, value);
        }

        /// <summary>
        /// 鼠标按下的边框画刷
        /// </summary>
        public static readonly DependencyProperty PressedBorderBrushProperty =
            DependencyProperty.RegisterAttached("PressedBorderBrush", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 禁用时的的背景画刷
        public static Brush GetDisabledBackground(DependencyObject obj)
        {
            return (Brush)obj.GetValue(DisabledBackgroundProperty);
        }

        public static void SetDisabledBackground(DependencyObject obj, Brush value)
        {
            obj.SetValue(DisabledBackgroundProperty, value);
        }

        /// <summary>
        /// 禁用时的的背景画刷
        /// </summary>
        public static readonly DependencyProperty DisabledBackgroundProperty =
            DependencyProperty.RegisterAttached("DisabledBackground", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 禁用时的的前景画刷
        public static Brush GetDisabledForeground(DependencyObject obj)
        {
            return (Brush)obj.GetValue(DisabledForegroundProperty);
        }

        public static void SetDisabledForeground(DependencyObject obj, Brush value)
        {
            obj.SetValue(DisabledForegroundProperty, value);
        }

        /// <summary>
        /// 禁用时的的前景画刷
        /// </summary>
        public static readonly DependencyProperty DisabledForegroundProperty =
            DependencyProperty.RegisterAttached("DisabledForeground", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region 禁用时的的边框画刷
        public static Brush GetDisabledBorderBrush(DependencyObject obj)
        {
            return (Brush)obj.GetValue(DisabledBorderBrushProperty);
        }

        public static void SetDisabledBorderBrush(DependencyObject obj, Brush value)
        {
            obj.SetValue(DisabledBorderBrushProperty, value);
        }

        /// <summary>
        /// 禁用时的的边框画刷
        /// </summary>
        public static readonly DependencyProperty DisabledBorderBrushProperty =
            DependencyProperty.RegisterAttached("DisabledBorderBrush", typeof(Brush), typeof(WpfXamlPropProxy));
        #endregion

        #region [附加属性]Path绘图时的Data数据
        public static Geometry GetPathData(DependencyObject obj)
        {
            return (Geometry)obj.GetValue(PathDataProperty);
        }
        public static void SetPathData(DependencyObject obj, Geometry value)
        {
            obj.SetValue(PathDataProperty, value);
        }
        /// <summary>
        /// [附加属性]Path绘图时的Data数据
        /// </summary>
        public static readonly DependencyProperty PathDataProperty =
            DependencyProperty.RegisterAttached("PathData", typeof(Geometry), typeof(WpfXamlPropProxy));
        #endregion

        #region [附加属性]滚动条的宽或高
        public static double GetScrollBarWidthOrHeight(DependencyObject obj)
        {
            return (double)obj.GetValue(ScrollBarWidthOrHeightProperty);
        }
        public static void SetScrollBarWidthOrHeight(DependencyObject obj, double value)
        {
            obj.SetValue(ScrollBarWidthOrHeightProperty, value);
        }
        /// <summary>
        /// [附加属性]滚动条的宽或高
        /// </summary>
        public static readonly DependencyProperty ScrollBarWidthOrHeightProperty =
            DependencyProperty.RegisterAttached("ScrollBarWidthOrHeight", typeof(double), typeof(WpfXamlPropProxy), new PropertyMetadata(8d));
        #endregion
    }
}
